﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using System.Data;
using KPIS.GERP.GHRMS.DAL;
using KPIS.GERP.GHRMS.MODEL;
using KPIS.GERP.GHRMS.IDAL;
using KPIS.GERP.GHRMS.IBLL;
using KPIS.GERP.GHRMS.DALFactory;

namespace KPIS.GERP.GHRMS.BLL
{
    public class DutyBLL : IDutyBLL
    {
        private static readonly IDutyDAL DAL = DataAccess.CreateDuties();
        private DutyInfo dutyInfo = new DutyInfo();
        public IList<DutyInfo> ListDuties(Nullable<int> Sequence)
        {
            int Seq = Sequence.HasValue ? (int) Sequence : 0;
            return DAL.ListDuties(new DutyInfo(Seq));
        }
        public void Insert(string Name, string Remarks, int CreatedBy)
        {
            try
            {
                DAL.Insert(new DutyInfo(0, Name, Remarks, CreatedBy, 0));
            }
            catch
            {
                throw;
            }
        }
        public void Update(int Sequence, string Name, string Remarks, int UpdatedBy)
        {
            try
            {
                DAL.Update(new DutyInfo(Sequence, Name, Remarks, 0, UpdatedBy));
            }
            catch
            {
                throw;
            }
        }
        public void Delete(int Sequence, int UpdatedBy)
        {
            try
            {
                DAL.Delete(Sequence, UpdatedBy);
            }
            catch
            {
                throw;
            }
        }
        
    }
}
